package com.approval.dto;

import lombok.Data;
import java.util.List;

/**
 * 分页响应DTO
 */
@Data
public class PageResponse<T> {
    
    private List<T> content;
    
    private Integer page;
    
    private Integer size;
    
    private Long total;
    
    private Integer totalPages;
    
    private Boolean hasNext;
    
    private Boolean hasPrevious;
    
    public PageResponse() {}
    
    public PageResponse(List<T> content, Integer page, Integer size, Long total) {
        this.content = content;
        this.page = page;
        this.size = size;
        this.total = total;
        this.totalPages = (int) Math.ceil((double) total / size);
        this.hasNext = page < totalPages;
        this.hasPrevious = page > 1;
    }
}
